<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>    
<%@page import="java.util.ArrayList"%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US" xml:lang="en">

<head>
    <!--
    Swim2 Theme - Ing. Software 2
    -->
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Swim2 - Risultati ricerca</title>
	<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
	<style type="text/css">
	.art-post .layout-item-0 { padding-right: 10px;padding-left: 10px; padding-right: 10px;padding-left: 10px; }
   </style>
</head>

<body>

	<div id="art-page-background-glare-wrapper">
    <div id="art-page-background-glare"></div>
	</div>
<div id="art-main">
    <div class="cleared reset-box"></div>
    
<!--HEADER-->
<div class="art-header">
	<div class="art-header-position">
		<div class="art-header-wrapper">
        	<div class="cleared reset-box"></div>
            	<div class="art-header-inner">
                <div class="art-headerobject"></div>
                <div class="art-logo">
                    <h1 class="art-logo-name"><a href="./index.jsp">SWIM v2</a></h1>
                </div>
                </div>
    	</div>
	</div>
</div>
<div class="cleared reset-box"></div>
    
<!--NAVBAR-->    
<div class="art-bar art-nav">
<div class="art-nav-outer">
<div class="art-nav-wrapper">
<div class="art-nav-inner">
<!--Blocks Menu-->
<ul class="art-hmenu">

		<c:set var="id" value="${requestScope.userId}" />
		<c:if test="${id != -1}">
		<li>
			<form method="post" action="ReturnUserPanel">
			<input id="id" name="id" type="hidden" value="<%= request.getAttribute("userId") %>">
			<input type="submit" class="menuForm" value="Torna alla pagina utente">
			</form>		
		</li>
		<li>
		<button class="menuForm" onclick="window.location.href='index.jsp';">Logout</button>	
		</li>
		</c:if>	
		<c:if test="${id == -1}">
		<li>
		<button name="nome" class="menuForm" onclick="location.href='/swim2WEB/index.jsp'">Torna alla Home</button>
		</li>
		</c:if>
</ul>	
</div>
</div>
</div>
</div>
<div class="cleared reset-box"></div>

<!--BOX-->
<div class="art-box art-sheet">
	<div class="art-box-body art-sheet-body">
    	<div class="art-layout-wrapper">
        	<div class="art-content-layout">
            	<div class="art-content-layout-row">
                	<div class="art-layout-cell art-content">

<div class="art-box art-post">
<div class="art-box-body art-post-body">
<div class="art-post-inner art-article">
					<!--Titolo centrale-->	
        <h2 class="art-postheader">
	<%
		ArrayList<String> users = (ArrayList<String>) request.getAttribute("usersString");
		if(users.size() > 0) {
			out.println("Ecco i risultati della ricerca:");
		}
		else {
			out.println("La ricerca non ha prodotto risultati");
		}
	%>
		</h2>
                                                
<div class="art-postcontent">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-0" style="width: 100%;">
    	<!--Contenuto principale-->

	<%
		if(users.size() > 0) {
			for(int i=0; i<users.size(); i=i+3) {
				out.println("<li>");
				out.println("<a href=\"UserPage.jsp?id="+users.get(i)+"&userId="+request.getAttribute("userId")+"&suggested=0\">"+users.get(i+1)+" "+users.get(i+2)+"</a>");
				out.println("</li>");
			}
		}
	%>
	
<!--Fine contenuto principale-->
</div>
</div>
</div>
</div>
<div class="cleared"></div>
                
</div>
<div class="cleared"></div>
</div>
</div>
					<div class="cleared"></div>
                	</div>
            	</div>
        	</div>
    	</div>
    <div class="cleared"></div>
    <div class="cleared"></div>
	</div>
</div>
    
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>

<!--FOOTER--> 
<div class="art-footer">
	<div class="art-footer-body">
    	<div class="art-footer-center">
        	<div class="art-footer-wrapper">
            	<div class="art-footer-text">
                	<p>Filippo Pellegrini - Alex Piermatteo - Matteo Tornielli</p>
                    <div class="cleared"></div>
                    <p class="art-page-footer">Swim v.2</p>
                </div>
            </div>
        </div>
        <div class="cleared"></div>
    </div>
</div>
<div class="cleared"></div>

<!--Fine main-->
</div>	

</body>
</html>